package com.healthlink.appcloudcalllib.keeplive;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.healthlink.appcloudcalllib.CloudCallManager;
import com.healthlink.appcloudcalllib.callback.MessageCallBack;
import com.healthlink.appcloudcalllib.common.Constants;
import com.healthlink.appcloudcalllib.utils.Out;

public class MsgReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {

        try {
            String msg=intent.getStringExtra("msg");
            if (msg.equals("ym101")){
                Constants.logs.add("收到通话广播:"+System.currentTimeMillis());
                CloudCallManager.getInstance().onServiceCallBack(1,"");
            }else if (msg.equals("ym102")){
                CloudCallManager.getInstance().onServiceCallBack(203,"");
            }else if (msg.equals("ym103")){
                CloudCallManager.getInstance().onServiceCallBack(2,"");
            }
            else if (msg.equals("ym104")){
                CloudCallManager.getInstance().onServiceCallBack(4,"");
            }
            else if (msg.equals("servicekill")){
                CloudCallManager.getInstance().onServiceCallBack(444,"");
            }
//            else if (msg.equals("ymdestory")){
//                CloudCallManager.getInstance().onServiceCallBack(777, "");
//            }
            else {
                if (msg.startsWith("showlogs@")){
                    try {
                        msg=msg.replace("showlogs@","");
                        Constants.logs.add(msg);
                    }catch (Exception e){

                    }

                }else {
                    CloudCallManager.getInstance().onServiceCallBack(888, msg);
                }


            }
        }catch (Exception e){
            e.printStackTrace();
            Out.out("ee=="+e.getMessage());
        }


    }
}
